package com.iotechn.unimall.admin.api.supplier;

import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;
import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.data.domain.SupplierDO;
import com.iotechn.unimall.data.model.Page;

import java.util.List;

/**
 * 供应商表
 *
 * @author hct
 * @email 77802226@qq.com
 * @date 2020-03-22 18:01:23
 */
@HttpOpenApi(group = "admin.supplier", description = "供应商管理")
public interface AdminSupplierService {

    @HttpMethod(description = "列表", permission = "supplier:supplier:list", permissionParentName = "供应商管理", permissionName = "供应商管理")
    public Page<SupplierDO> list(
            @HttpParam(name = "supplierName", type = HttpParamType.COMMON, description = "供应商名称", valueDef = "") String supplierName,
            @HttpParam(name = "supplierContacts", type = HttpParamType.COMMON, description = "联系人", valueDef = "") String supplierContacts,
            @HttpParam(name = "supplierPhone", type = HttpParamType.COMMON, description = "联系电话", valueDef = "") String supplierPhone,
            @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
            @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页长度", valueDef = "20") Integer limit,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId,
            @HttpParam(name="status",type=HttpParamType.COMMON,description = "状态")String status) throws ServiceException;

    @HttpMethod(description = "创建", permission = "supplier:supplier:create", permissionParentName = "供应商管理", permissionName = "供应商管理")
    public SupplierDO create(
            @NotNull @HttpParam(name = "supplierDO", type = HttpParamType.COMMON, description = "") SupplierDO supplierDO,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "修改", permission = "supplier:supplier:update", permissionParentName = "供应商管理", permissionName = "供应商管理")
    public String update(
            @NotNull @HttpParam(name = "supplierDO", type = HttpParamType.COMMON, description = "") SupplierDO supplierDO,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "删除", permission = "supplier:supplier:delete", permissionParentName = "供应商管理", permissionName = "供应商管理")
    public String delete(
            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "删除Id") Long id,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "详情", permission = "supplier:supplier:detail", permissionParentName = "供应商管理", permissionName = "供应商管理")
    public SupplierDO detail(
            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "Id") Long id,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "激活/冻结", permission = "supplier:supplier:active", permissionParentName = "供应商管理", permissionName = "供应商管理")
    public String updateStatus(
            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "") Long id,
            @NotNull @HttpParam(name = "status", type = HttpParamType.COMMON, description = "") Integer status,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;
    @HttpMethod(description = "获取所有供应商",permission = "supplier:supplier:list", permissionParentName = "供应商管理", permissionName = "供应商管理")
    public List<SupplierDO> listSuppliersByPara(@HttpParam(name = "status")String status)throws ServiceException;
}

